load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load(
    "//fboss/agent/hw/benchmarks:agent_hw_benchmarks.bzl",
    "agent_benchmark_lib",
)

oncall("fboss_agent_push")

agent_benchmark_lib(
    name = "hw_tx_slow_path_rate",
    srcs = ["HwTxSlowPathBenchmark.cpp"],
)

agent_benchmark_lib(
    name = "hw_rx_slow_path_rate",
    srcs = ["HwRxSlowPathBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent:core",
        "//fboss/agent:packet",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/test/utils:acl_test_utils",
        "//fboss/agent/test/utils:copp_test_utils",
        "//fboss/agent/test/utils:qos_test_utils",
        "//fboss/agent/test/utils:trap_packet_utils",
        "//folly:network_address",
        "//folly/init:init",
    ],
)

cpp_library(
    name = "hw_bgp_rx_slow_benchmark_helpers",
    headers = [
        "HwBGPRxSlowPathBenchmarkHelpers.h",
    ],
    exported_deps = [
        "//fboss/agent:packet",
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:ecmp_helper",
        "//fboss/agent/test:route_scale_gen",
        "//fboss/agent/test/utils:copp_test_utils",
        "//fboss/agent/test/utils:port_flap_helper",
        "//fboss/agent/test/utils:qos_test_utils",
        "//fboss/agent/test/utils:stress_test_utils",
    ],
)

agent_benchmark_lib(
    name = "hw_bgp_rx_slow_path_rate",
    srcs = ["HwBGPRxSlowPathBenchmark.cpp"],
    extra_deps = [
    ],
)

agent_benchmark_lib(
    name = "hw_rx_slow_path_arp_rate",
    srcs = ["HwRxSlowPathArpBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent:core",
        "//fboss/agent:packet",
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/packet:packet_factory",
        "//fboss/agent/test/utils:acl_test_utils",
        "//fboss/agent/test/utils:asic_test_utils",
        "//fboss/agent/test/utils:copp_test_utils",
        "//fboss/agent/test/utils:qos_test_utils",
        "//folly:network_address",
        "//folly/init:init",
    ],
)

agent_benchmark_lib(
    name = "hw_system_scale_memory_benchmark",
    srcs = ["HwSystemScaleMemoryBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/test/utils:agent_fsdb_integ_bench_helper",
        "//fboss/agent/test/utils:system_scale_test_utils",
        "//folly/init:init",
    ],
)

agent_benchmark_lib(
    name = "hw_system_scale_churn_memory_benchmark",
    srcs = ["HwSystemScaleChurnMemoryBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/test/utils:agent_fsdb_integ_bench_helper",
        "//fboss/agent/test/utils:system_scale_test_utils",
        "//folly/init:init",
    ],
)

cpp_library(
    name = "hw_route_scale_benchmark_helpers",
    srcs = ["HwRouteScaleBenchmarkHelpers.cpp"],
    headers = [
        "HwRouteScaleBenchmarkHelpers.h",
    ],
    undefined_symbols = True,
    exported_deps = [
        "//fboss/agent:agent_features",
        "//fboss/agent:core",
        "//fboss/agent:utils",
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:ecmp_helper",
        "//fboss/agent/test:resourcelibutil",
        "//fboss/agent/test/utils:dsf_config_utils",
        "//fboss/agent/test/utils:fabric_test_utils",
        "//fboss/agent/test/utils:voq_test_utils",
        "//fboss/lib:function_call_time_reporter",
        "//folly:benchmark",
    ],
)

cpp_library(
    name = "hw_stats_collection_benchmark_helper",
    headers = [
        "HwStatsCollectionBenchmarkHelper.h",
    ],
    exported_deps = [
        "//fboss/agent:agent_features",
        "//fboss/agent:asic_utils",
        "//fboss/agent:sw_agent_initializer",
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test/utils:copp_test_utils",
        "//fboss/agent/test/utils:dsf_config_utils",
        "//fboss/agent/test/utils:load_balancer_test_utils",
        "//fboss/agent/test/utils:network_ai_qos_utils",
        "//fboss/agent/test/utils:voq_test_utils",
        "//folly:benchmark",
        "//folly:network_address",
    ],
)

agent_benchmark_lib(
    name = "hw_stats_collection_speed",
    srcs = ["HwStatsCollectionBenchmark.cpp"],
    extra_deps = [
        ":hw_stats_collection_benchmark_helper",
    ],
)

agent_benchmark_lib(
    name = "hw_fsw_scale_route_add_speed",
    srcs = ["HwFswScaleRouteAddBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_fsw_scale_route_del_speed",
    srcs = ["HwFswScaleRouteDelBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_th_alpm_scale_route_add_speed",
    srcs = ["HwThAlpmScaleRouteAddBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_th_alpm_scale_route_del_speed",
    srcs = ["HwThAlpmScaleRouteDelBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_hgrid_du_scale_route_add_speed",
    srcs = ["HwHgridDUScaleRouteAddBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_hgrid_du_scale_route_del_speed",
    srcs = ["HwHgridDUScaleRouteDelBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_hgrid_uu_scale_route_add_speed",
    srcs = ["HwHgridUUScaleRouteAddBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_hgrid_uu_scale_route_del_speed",
    srcs = ["HwHgridUUScaleRouteDelBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_anticipated_scale_route_add_speed",
    srcs = ["HwAnticipatedScaleRouteAddBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_anticipated_scale_route_del_speed",
    srcs = ["HwAnticipatedScaleRouteDelBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_ecmp_shrink_speed",
    srcs = ["HwEcmpShrinkSpeedBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/hw/test:hw_test_ecmp_utils",
        "//fboss/agent/hw/test:hw_test_port_utils",
        "//fboss/agent/test/utils:ecmp_test_utils",
    ],
)

cpp_library(
    name = "hw_init_and_exit_benchmark_helper",
    srcs = ["HwInitAndExitBenchmarkHelper.cpp"],
    undefined_symbols = True,
    exported_deps = [
        "//fboss/agent:apply_thrift_config",
        "//fboss/agent:core",
        "//fboss/agent:switch_config-cpp2-types",
        "//fboss/agent:utils",
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/hw/switch_asics:switch_asics",
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/hw/test:hw_copp_utils",
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/hw/test:prod_config_utils",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:route_distribution_gen",
        "//fboss/agent/test:route_scale_gen",
        "//fboss/agent/test/utils:dsf_config_utils",
        "//fboss/agent/test/utils:fabric_test_utils",
        "//fboss/agent/test/utils:voq_test_utils",
        "//fboss/lib:function_call_time_reporter",
        "//folly:benchmark",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_40Gx10G",
    srcs = ["HwInitAndExit40Gx10GBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_100Gx10G",
    srcs = ["HwInitAndExit100Gx10GBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_100Gx25G",
    srcs = ["HwInitAndExit100Gx25GBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_100Gx50G",
    srcs = ["HwInitAndExit100Gx50GBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_100Gx100G",
    srcs = ["HwInitAndExit100Gx100GBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_400Gx400G",
    srcs = ["HwInitAndExit400Gx400GBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_voq",
    srcs = ["HwInitAndExitVoqBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_init_and_exit_fabric",
    srcs = ["HwInitAndExitFabricBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_init_and_exit_benchmark_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)

agent_benchmark_lib(
    name = "hw_ecmp_shrink_with_competing_route_updates_speed",
    srcs = ["HwEcmpShrinkWithCompetingRouteUpdatesBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/hw/test:hw_test_ecmp_utils",
        "//fboss/agent/hw/test:hw_test_port_utils",
        "//fboss/agent/test:route_distribution_gen",
        "//fboss/agent/test:route_scale_gen",
        "//fboss/agent/test/utils:ecmp_test_utils",
    ],
)

agent_benchmark_lib(
    name = "hw_turbo_fabric_route_add",
    srcs = ["HwTurboFabricRouteAddBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_turbo_fabric_route_del",
    srcs = ["HwTurboFabricRouteDelBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_rib_resolution_speed",
    srcs = ["HwRibResolutionBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/test:route_gen_test_utils",
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_rib_sync_fib_speed",
    srcs = ["HwRibSyncFibBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/test:route_gen_test_utils",
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_flowlet_stats_collection_speed",
    srcs = ["HwFlowletStatsCollectionBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/test:hw_test_ecmp_utils",
        "//fboss/agent/hw/test:load_balancer_utils",
        "//fboss/agent/test/utils:udf_test_utils",
    ],
)

agent_benchmark_lib(
    name = "hw_voq_scale_route_add_speed",
    srcs = ["HwVoqScaleRouteAddBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_voq_scale_route_del_speed",
    srcs = ["HwVoqScaleRouteDelBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/test:route_scale_gen",
    ],
)

agent_benchmark_lib(
    name = "hw_switch_reachability_change_speed",
    srcs = [
        "HwSwitchReachabilityChangeBenchmarkHelper.cpp",
        "HwSwitchReachabilityChangeFabricBenchmark.cpp",
        "HwSwitchReachabilityChangeVoqBenchmark.cpp",
    ],
    extra_deps = [
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/hw/test:hw_test_thrift_handler_h",
    ],
)

agent_benchmark_lib(
    name = "hw_voq_sys_port_programming",
    srcs = ["HwVoqSysPortProgrammingBenchmark.cpp"],
    extra_deps = [],
)

cpp_library(
    name = "hw_voq_remote_entity_benchmark_helpers",
    headers = [
        "HwVoqRemoteEntityBenchmarkHelper.h",
    ],
    exported_deps = [
        "//fboss/agent:agent_features",
        "//fboss/agent:core",
        "//fboss/agent:fib_helpers",
        "//fboss/agent:utils",
        "//fboss/agent/benchmarks:agent_benchmarks_h",  # @manual
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test/utils:dsf_config_utils",
        "//fboss/agent/test/utils:voq_test_utils",
        "//fboss/lib:function_call_time_reporter",
        "//folly:benchmark",
    ],
)

agent_benchmark_lib(
    name = "hw_voq_remote_entity_programming",
    srcs = ["HwVoqRemoteEntityProgrammingBenchmark.cpp"],
    extra_deps = [":hw_voq_remote_entity_benchmark_helpers"],
)

cpp_library(
    name = "hw_voq_route_competing_remote_neighbor_benchmark_helper",
    headers = [
        "HwVoqRouteCompetingRemoteNeighborBenchmarkHelper.h",
    ],
    exported_deps = [
        ":hw_route_scale_benchmark_helpers",
        "//fboss/agent:agent_features",
        "//fboss/agent:core",
        "//fboss/agent:fib_helpers",
        "//fboss/agent:utils",
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test/utils:dsf_config_utils",
        "//fboss/agent/test/utils:voq_test_utils",
        "//fboss/lib:function_call_time_reporter",
        "//folly:benchmark",
        "//folly:synchronized",
    ],
)

agent_benchmark_lib(
    name = "hw_voq_route_competing_remote_neighbor_benchmark",
    srcs = ["HwVoqRouteCompetingRemoteNeighborBenchmark.cpp"],
    extra_deps = [
        ":hw_voq_route_competing_remote_neighbor_benchmark_helper",
    ],
)

agent_benchmark_lib(
    name = "hw_clear_interface_phy_counters",
    srcs = ["HwClearInterfacePhyCountersBenchmark.cpp"],
    extra_deps = [],
)

cpp_library(
    name = "hw_tun_manager_probe_benchmark_helper",
    headers = [
        "HwTunManagerProbeBenchmarkHelper.h",
    ],
    exported_deps = [
        "//fboss/agent:agent_features",
        "//fboss/agent:core",
        "//fboss/agent:sw_agent_initializer",
        "//fboss/agent/hw/test:config_factory",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:utils",
        "//folly:benchmark",
    ],
)

agent_benchmark_lib(
    name = "hw_tun_manager_probe_and_cleanup_speed",
    srcs = ["HwTunManagerProbeBenchmark.cpp"],
    extra_deps = [
        ":hw_tun_manager_probe_benchmark_helper",
    ],
)

agent_benchmark_lib(
    name = "hw_ecmp_backup_group_spillover",
    srcs = ["HwEcmpBackupGroupSpilloverBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/hw/test:hw_test_ecmp_utils",
        "//fboss/agent/hw/test:hw_test_port_utils",
        "//fboss/agent/test/utils:ecmp_test_utils",
        "//fboss/agent/test/utils:load_balancer_test_utils",
        "//fboss/agent/test/utils:scale_test_utils",
    ],
)

agent_benchmark_lib(
    name = "hw_ecmp_group_scale_benchmark",
    srcs = ["HwEcmpGroupScaleBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/test:hw_switch_ensemble_factory",
        "//fboss/agent/hw/test:hw_test_ecmp_utils",
        "//fboss/agent/hw/test:hw_test_port_utils",
        "//fboss/agent/test/utils:ecmp_test_utils",
        "//fboss/agent/test/utils:load_balancer_test_utils",
        "//fboss/agent/test/utils:scale_test_utils",
    ],
)

cpp_library(
    name = "hw_ucmp_group_scale_helper",
    headers = ["HwUcmpScaleBenchmarkHelper.h"],
    exported_deps = [
        "//fboss/agent:fib_helpers",
        "//fboss/agent/test:agent_ensemble",
        "//fboss/agent/test:ecmp_helper",
        "//fboss/agent/test/utils:config_utils",
        "//fboss/agent/test/utils:scale_test_utils",
        "//folly:benchmark",
        "//folly:network_address",
        "//folly/logging:logging",
    ],
)

agent_benchmark_lib(
    name = "hw_ucmp_scale_benchmark",
    srcs = ["HwUcmpScaleBenchmark.cpp"],
    extra_deps = [
        "//fboss/agent/hw/benchmarks:hw_ucmp_group_scale_helper",
        "//fboss/agent/hw/test:config_factory",
    ],
)
